// const app = getApp()
Component({
    data: {
        selected: 0,
        color: '#8691A3',
        selectedColor: '#2EA1FF',
        list: [
            {
                pagePath: '/pages/index/index',
                iconPath: '/static/tabbar/home.png',
                selectedIconPath: '/static/tabbar/home-active.png',
                text: '首页'
            },
            {
                pagePath: '/pages/message/index',
                iconPath: '/static/tabbar/message.png',
                selectedIconPath: '/static/tabbar/message-active.png',
                text: '消息',
                badge: 0
            },
            {
                pagePath: '/pages/my/index',
                iconPath: '/static/tabbar/my.png',
                selectedIconPath: '/static/tabbar/my-active.png',
                text: '我的'
            }
        ]
    },
    methods: {
        switchTab (e) {
            // 震动反馈
            wx.vibrateShort({
                type: 'heavy'
            })
            const data = e.currentTarget.dataset
            const url = data.path
            wx.switchTab({
                url
            })
            this.setData({
                selected: data.index
            })
        }
    }
})
